import { createRouter, createWebHashHistory } from 'vue-router';
import login from '../views/login.vue';
import admin from '../views/admin.vue';
import register from '../views/register.vue';
import index from "../views/index.vue";
import oneword from "../components/oneWord.vue";
import personal from "../components/PersonalCenter.vue";
import filelist from "../components/FileList.vue";
import upload from "../views/upload.vue";

const routes = [
    {
        path: '/',
        name: 'login',
        component: login
    },
    {
        path: '/register',
        name: 'register',
        component: register
    },
    {
        path: '/index',
        name: 'index',
        component: index,
        redirect: '/oneword',
        children: [
            {path: '/oneword', name: 'oneword', component: oneword},
            {path: '/personal', name: 'personal', component: personal},
            {path: '/filelist', name: 'filelist', component: filelist},
            {path: '/upload', name: 'upload', component: upload}
        ]
    },
    {
        path: '/adminLogin',
        name: 'admin',
        component: admin
    }
];

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;